package com.slz3.business.module.configManagement.conZoneTemplate.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conZoneTemplate.domain.ConZoneTemplate;
import com.slz3.business.module.configManagement.conZoneTemplate.domain.ConZoneTemplateFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConZoneTemplateTransactionalServiceImpl implements ConZoneTemplateTransactionalService {

    @Override
    public ConZoneTemplate modify(ConZoneTemplate conZoneTemplateNew) {
        Repositorys.conZoneTemplate.test();
        Repositorys.conZoneTemplate.save(ConZoneTemplateFactory.initBaseFields());
        System.err.println(1/0);
        conZoneTemplateNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conZoneTemplate.saveAndFlush(conZoneTemplateNew);
    }

    @Override
    public List<ConZoneTemplate> batchModify(List<ConZoneTemplate> conZoneTemplateList) {
        return Repositorys.conZoneTemplate.saveAll(conZoneTemplateList);
    }
}
